// 请求 HTML 数据 并解析
let http = require("http");
let fs = require('fs');
let myReadStream;

// 写在这里不对，浏览器刷新什么都没有了
//  myReadStream = fs.createReadStream(__dirname + "/index.html", "utf8");
// request 请求对象   response 响应的对象
let server = http.createServer(function (request, response) {
	// 如果是 text/plain 浏览器就不会解析HTML了
    response.writeHead(200, {"Content-Type": "text/html"});

    // 把 HTML 写入响应 
    myReadStream = fs.createReadStream(__dirname + "/index.html", "utf8");
    myReadStream.pipe(response)

});
server.listen(3000, "127.0.0.1");
console.log("Server running at http://127.0.0.1:3000/");
	
	
	